package aspects;
import models.*;
import models.msgs.*;
import models.msgs.IMessage;

import org.aspectj.lang.annotation.*;

@Aspect
public class Logger {
	/*@Before("execution(public * onReceive(..)) && args(message)")
	public void log(Object message) {
		if( message instanceof IMessage) {
			play.Logger.info(((IMessage)message).getMessageString());
		
		}
		
		
	}*/
	@Before("execution(public * notifyAll(..)) && args(message)")
	public void log2(Object message) {
		if(message instanceof IMessage) {
			play.Logger.info(((IMessage)message).getMessageString());
		
		}
	}
	@Before("execution(public * notifyOne(..)) && args(message, nr)")
	public void log3(Object message, Object nr) {
		if( message instanceof IMessage) {
			
			play.Logger.info((int)nr +": " +  ((IMessage)message).getMessageString());
		
		}
	}
}
